namespace ApplicationControllerExample.Views.Main
{
    using ApplicationControllerExample.Model.Commands;
    using Core;
    using EventAggregator;

    public class MainPresenter : IEventHandler<SomeEventData>
    {
        public MainPresenter(IMainView mainView, IApplicationController appController)
        {
            View = mainView;
            AppController = appController;
            View.Presenter = this;
        }

        private IMainView View { get; set; }
        private IApplicationController AppController { get; set; }

        #region IEventHandler<SomeEventData> Members

        public void Handle(SomeEventData eventData)
        {
            View.SaySomething(eventData.Message);
        }

        #endregion

        public void Run()
        {
            View.Run();
        }

        public void DoSomething()
        {
            AppController.Execute(new SomeCommandData());
        }

        public void SomethingElseIsHappening()
        {
            AppController.Raise(new SomeEventData("Something done here"));
        }
    }
}